#include "def.h"

void ChangeMap(Graph &G){
			
	cout<<"请输入要修改的景点序号（输入-1返回）"<<endl;		
    int index;
    cin>>index;
	    
    if(index==-1){
    	system("cls");
	}
	else if (index < 0 || index >= G.vertexNum) {
        cout<<"未找到该景点！按任意键以重新输入..."<<endl;
        getch();
        system("cls");
        printInfo(G);
        ChangeMap(G);
    }
	else{
		cin.ignore();
		cout<<"请输入该景点的新信息"<<endl<<"景点名字：";
    	cin.getline(G.vexs[index-1].name, MaxSize);
		cout<<"景点介绍：";
    	cin.getline(G.vexs[index-1].info, 512);
    	
		for(int i;i<G.vertexNum;i++){
			if(G.arcs[index-1][i]!=INF){
				cout<<"到"<<G.vexs[i].name<<"的距离：";
				int distance;
	    		cin>>distance;
	    		G.arcs[index-1][i]=distance;
	    		G.arcs[i][index-1]=distance;	    		
			}	    	 
    	}
    	WriteMap(G);
    	cout<<"修改成功!按任意键返回主菜单..."<<endl;
		getch();
	}	
}